/*
 * @Description:序列化对象
 * 
 * @Author: rendc
 * 
 * @Date: 2024-10-15 15:00:50
 * 
 * @LastEditors: rendc
 * 
 * @LastEditTime: 2024-10-15 15:21:43
 */

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

/**
 * Test06
 */
public class Test06 {

  public static void main(String[] args) throws Exception {
    // 序列化对象
    ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("/Users/cc/Desktop/Java/day33/Student.txt"));
    // 创建对象
    Student student = new Student("Student", 20);
    Student student2 = new Student("Student2", 22);
    // 序列化
    oos.writeObject(student);
    oos.writeObject(student2);
    System.out.println("对象序列化成功");
    // 关闭流
    oos.close();
  }
}